This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
~Zelda Reboosicheknivu 21.Oct.03 10:04 PM a Web browser Domino DesignerAll ReleasesAll Platforms
I am stuck with a bit of a conundrum... I need to come up with a random number between 1 and 6.
This function creates a random between 1 and 5, but just trying to get over the odd fractions seems weird...
l% = ((round(Fraction(Rnd),1) * 10) Mod 5) + 1
pretty much what this does is grab the first decimal value of the randomly generated number between 0 and 1 - multiplies it by 10 - giving me a number between 0 and 9 - performs a modulo on it so example:
case 0 ( 0 mod 5 = 0)
case 1 ( 1 mod 5 = 0)
case 2 ( 2 mod 5 = 0)
case 3 ( 3 mod 5 = 0)
case 4 ( 4 mod 5 = 0)
case 5 ( 5 mod 5 = 0)
case 6 ( 6 mod 5 = 1)
case 7 ( 7 mod 5 = 2)
case 8 ( 8 mod 5 = 3)
case 9 ( 9 mod 5 = 4)
Then adds 1 to come up with numbers between 1 and 5.
Some issues -
1. it is really difficult to get to six with this type of function.
2. I will end up with an inordinate amount of 0's (adjusted to 1 in the original function)
This seems like it should be simple... but it isn't kicking me that way...
It would be way easier if there was a function that set the lower and upper bounds of your result (like VB) such as: